<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="./layui/css/layui.css" rel="stylesheet">
<script src="./layui/layui.js"></script>
<title>文件上传</title>
<script>
	// 判断是否填写上传人并已选择上传文件
	function check() {
		var name = document.getElementById("name").value;
		var file = document.getElementById("file").value;
		if (name == "") {
			alert("填写上传人");
			return false;
		}
		if (file.length == 0 || file == "") {
			alert("请选择上传文件");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
	<div class="layui-container">
		<form action="${pageContext.request.contextPath }/fileUpload"
			method="post" enctype="multipart/form-data" onsubmit="return check()"
			class="layui-form">

			<div class="layui-form-item">
				<label class="layui-form-label">上传人：</label>
				<div class="layui-input-inline">
					<input id="name" type="text" name="name" required
						lay-verify="required" placeholder="请输入上传人" autocomplete="off"
						class="layui-input" />
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">请选择文件：</label>
				<div class="layui-input-inline">
					<input id="file" type="file" name="uploadfile" multiple="multiple"
						required lay-verify="required" placeholder="请输入文件名"
						autocomplete="off" class="layui-input" />
				</div>
			</div>


<!--  			上传人：<input id="name" type="text" name="name" required
				lay-verify="required" placeholder="请输入上传人" autocomplete="off"
				class="layui-input" /><br /> 请选择文件：<input id="file" type="file"
				name="uploadfile" multiple="multiple" required lay-verify="required"
				placeholder="请输入文件名" autocomplete="off" class="layui-input" /><br />
-->

			<input type="submit" class="layui-btn" value="上传" />
		</form>
	</div>
</body>
</html>
